<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript" src="./js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<style type="text/css">
.content {
	width: 50em;
	height: auto;
}
</style>

</head>
<body>

	<div class="container">
		<h1 class="text-munt">
			欢迎您，
			<s:property value="#session['name']" />
		</h1>
		<hr />
		<div class="content">

			<table class="table table-bordered" role="table">

				<tr>
					<s:form action="showAlluser" method="post" theme="simple">
						<td>操作一</td>
						<td><input type="submit" class="btn btn-primary"
							value="查看所有的用户" /></td>
						<td></td>
					</s:form>
				</tr>
				<tr>
					<s:form action="showAllbook" method="post" theme="simple">
						<td>操作二</td>
						<td><input type="submit" class="btn btn-primary"
							value="查看所有书籍" /></td>
						<td><input type="button" class="btn btn-primary" value="添加书籍"
							onclick="addBook()" /></td>
					</s:form>
				</tr>
			</table>
		</div>
	</div>
	<div class="container">
		<div id="editeare" class="content"></div>
		<s:if test="#session['statusInfo']">
			<script type="text/javascript">
				
			<%session.removeAttribute("statusInfo");%>
				alert('添加成功');
				window.location.href = "main.jsp";
			</script>
		</s:if>

	</div>

	<script type="text/javascript">
		function addBook() {
			var xmlhttp = new XMLHttpRequest();
			xmlhttp.onreadystatechange = function() {
				if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					document.getElementById('editeare').innerHTML = xmlhttp.responseText;
					console.log(xmlhttp.responseText);
				}
			}
			xmlhttp.open('GET', 'addbookajax.action', true);
			xmlhttp.send();
		}
	</script>
</body>
</html>